

/**
 * @file CombinedVar.cpp
 * Class to define and handle 'descriptions' of GNSS variables.
 */

//============================================================================
//
// 2020/03/1
//
//============================================================================


#include "Variable.hpp"
#include "CombinedVar.hpp"


namespace gpstk
{

      // Equality operator
   bool CombinedVar::operator==(const CombinedVar& right) const
   {

      return ( 
               ( firstVar == right.getFirstVar() )     &&
               ( secondVar == right.getSecondVar() )   
             );            

   }  // End of 'Variable::operator=='



      // This ordering is somewhat arbitrary, but is required to be able
      // to use a Variable as an index to a std::map, or as part of a
      // std::set.
   bool CombinedVar::operator<(const CombinedVar& right) const
   {

       if(firstVar==right.getFirstVar())
       {
           return ( secondVar < right.getSecondVar() );
       }
       else
       {
           return ( firstVar < right.getFirstVar() );
       }

   }  // End of 'Variable::operator<'



      // Assignment operator.
   CombinedVar& CombinedVar::operator=(const CombinedVar& right)
   {

         // First check if these Variables are the same
      if ( this == &right ) return (*this);

         // If Variables are different, then set values of all fields
      setFirstType( right.getFirstType() );
      setSecondType( right.getSecondType() );

      setFirstCoeff( right.getFirstCoeff() );
      setSecondCoeff( right.getSecondCoeff() );

      setFirstVar( right.getFirstVar() );
      setSecondVar( right.getSecondVar() );

      return *this;

   }  // End of 'Variable::operator='



}  // End of namespace gpstk
